#include <cstdio>
#include <algorithm>

#define MAX_NUMBERS 1000
typedef int number;

inline int get_number (number &n)
{
	return scanf ("%d", &n);
}


template <typename N>
inline N abs (const N &n)
{
	return n < 0 ? -n : n;
}


struct Number
{
	number n;
	int p;
};


inline bool operator < (const Number &n1, const Number &n2)
{
	return n1.n < n2.n;
}


Number list[MAX_NUMBERS];


int main ()
{
	int n, i, flips;
	Number *pn;

	while (scanf ("%d", &n) == 1)
	{
		for (i = 0, pn = list; i < n; ++i, ++pn)
		{
			get_number (pn->n);
			pn->p = i;
		}

		std::sort (list, pn);

		flips = 0;
		for (i = 0, pn = list; i < n; ++i, ++pn)
		{
			flips += abs (pn->p - i);
			fprintf(stderr, "\t%d %d (%d)\n", pn->n, pn->p, abs(pn->p - i));
		}

		printf("Minimum exchange operations : %d\n", flips);
	}

	return 0;
}